package com.autotest.sync.stf;

import com.alibaba.fastjson.JSONObject;

/** 
 * 从本地服务器抽取相关数据
 * @author thomas.ning
 * @version 2016年4月26日 下午3:16:40
 */
public class DeviceInfo {
	public String serial = null;
	public String imei = null;
	public String imei2 = null;
	public String sw_version = null;
	public String sw_version_raw = null;
	public String sdk_version = null;
	public String manufacturer = null;
	public String smartisan_tag = null;   //se，sek,非se
	public String phase = null;          //机器批次 dvt pvt
	public String date_utc = null;       //ota需要
	public String build_type = null;     //ota需要
	public String cpuAbi = null;
	public String model = null;
	public String name = null;
	public String size = null;
	public String sim1 = null;
	public String sim2 = null;
	public int mem_size = 0;
	public int handset = 0; //有无耳机
	public int sdcard = 0; //有无sdcard
	
	public DeviceInfo(){
		
	}
	
	public String toJsonString(){
		JSONObject json = new JSONObject();
		json.put("serial", serial);
		json.put("imei", imei);
		json.put("imei2", imei2);
		json.put("sw_version", sw_version);
		json.put("sdk_version", sdk_version);
		json.put("sw_version_raw", sw_version_raw);
		json.put("smartisan_tag", smartisan_tag);
		json.put("phase", phase);
		json.put("date_utc", date_utc);
		json.put("build_type",build_type);
		json.put("manufacturer", manufacturer);
		json.put("cpu_abi", cpuAbi);
		json.put("model", model);
		json.put("name", name);
		json.put("size", size);
		json.put("sim1", sim1);
		json.put("sim2", sim2);
		return json.toJSONString();
	}
	
	
	@Override
	public String toString(){
		return toJsonString();
	}
	/**
	 * 对比设备信息是否相同
	 * @param deviceInfo
	 * @return
	 */
	public boolean compareto(DeviceInfo deviceInfo){
		if(this.serial != deviceInfo.serial){
			return false;
		}
		if(this.imei != deviceInfo.imei){
			return false;
		}
		if(this.imei2 != deviceInfo.imei2){
			return false;
		}
		if(this.sw_version != deviceInfo.sw_version){
			return false;
		}
		if(this.sdk_version != deviceInfo.sdk_version){
			return false;
		}
		if(this.manufacturer != deviceInfo.manufacturer){
			return false;
		}
		if(this.cpuAbi != deviceInfo.cpuAbi){
			return false;
		}
		if(this.model != deviceInfo.model){
			return false;
		}
		if(this.name != deviceInfo.name){
			return false;
		}
		if(this.size != deviceInfo.size){
			return false;
		}
		if(this.sim1 != deviceInfo.sim1){
			return false;
		}
		if(this.sim2 != deviceInfo.sim2){
			return false;
		}
		if(this.handset != deviceInfo.handset){
			return false;
		}
		if(this.sdcard != deviceInfo.sdcard){
			return false;
		}
		if(this.mem_size != deviceInfo.mem_size){
			return false;
		}
		return true;
	}

}

